package com.example.demo.Controller;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.example.demo.service.IComputedService;
import lombok.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.net.URLEncoder;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.demo.entity.ComputedData;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;


@CrossOrigin
@RestController
@RequestMapping("/computed")
public class ComputedController {
    @Resource
    private IComputedService computedService;

    @PostMapping
    public boolean save(@RequestBody ComputedData computedData) {
        return computedService.saveOrUpdate(computedData);
    }

    @DeleteMapping("/{id}")
    public Boolean delete(@PathVariable Integer id) {
        return computedService.removeById(id);
    }

    @GetMapping
    public List<ComputedData> findAll() {
        return computedService.list();
    }

    @GetMapping("/{id}")
    public ComputedData findOne(@PathVariable Integer id) {
        return computedService.getById(id);
    }


}
